package com.cqc.stateframelayout01;

import android.app.ActionBar;
import android.app.ListActivity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;

/**
 * Created by ${cqc} on 2017/9/11.
 */

public class MainActivity extends ListActivity {

    private Context context = this;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        String[] types = getResources().getStringArray(R.array.type);
        setListAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_activated_1, types));
    }

    @Override
    protected void onListItemClick(ListView listView, View view, int position, long id) {
        super.onListItemClick(listView, view, position, id);
        Intent intent = null;
        switch (position) {
            case 0:
                intent = new Intent(context, StateFrameLayoutActivity.class);
                break;
            case 1:
                break;
            case 2:
                break;
            case 3:
                break;
        }
        startActivity(intent);
    }
}
